Skip to content

Add opt-in live model API smoke tests - #537

Merged
robgruen merged 3 commits into
mainfrom
issue-328-opt-in-live-tests
Nov 24, 2026
Merged

robgruen merged 3 commits into
mainfrom
issue-328-opt-in-live-tests

Conversation

@robgruen

@robgruen robgruen commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #328. Continues mikemikimike's implementation from the closed, unmerged #430.

  • Keep mocked regression tests unconditional; require TYPECHAT_LIVE_TESTS=1 for the separate, process-isolated live smoke test.
  • Use the existing environment-based model factory for OpenAI Chat Completions, Responses, and Azure OpenAI.
  • Bound the live request to 30 seconds with no retries and a 35-second test timeout. Missing configuration, request failures, and blank completions fail visibly instead of skipping or falling back to mocks.
  • Document configuration, provider charges, and PowerShell usage. No core API or Python changes.

Contributor credit

The first two commits preserve mikemikimike's original author metadata from #430:

The follow-up commit also includes their co-author attribution. Please retain contributor attribution if squash-merging.

Validation

Using the pinned Node.js 24.22.1 runtime:

  • Build and focused model/live-runner tests: 127 passed.
  • npm test: 422 passed, 0 failed; the real-provider suite remains disabled by default.
  • Deterministic loopback HTTP fixtures verify opt-in gating, missing configuration, all three API routes, native-fetch isolation from mocked suites, single-attempt HTTP failures, blank completions, and the measured 30-second stalled-request timeout.
  • Original author name, email, and timestamp verified against both source commits.

Additional owner-requested online/offline verification

Using Node.js 24.22.1 against the same PR head:

  • Offline npm test, with live provider calls disabled: 422 passed, 0 failed.
  • Live-enabled npm test: 423 passed, 0 failed, including a real completion against the owner-selected Azure gpt_4_1 deployment using identity authentication.
  • Isolated real-provider live suite: 1 passed, 0 failed; the model request completed in approximately 3.3 seconds.
  • The first live-enabled full run had one fetch failed transport error. Endpoint reachability checks, an isolated live rerun, and the complete live-enabled rerun subsequently passed. No source, timeout, or retry settings were changed to obtain passing results.

The verification used the same DefaultAzureCredential flow as TypeAgent, backed by existing Azure CLI authentication. The short-lived bearer token was passed only through the test process environment; no credentials or private endpoint details were written to repository configuration, committed, or included in this PR.

mikemikimike and others added 3 commits November 23, 2026 11:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Continue the implementation from #430 with process-isolated live tests, explicit configuration failures, offline HTTP regression coverage, and usage documentation.

Co-authored-by: mikemikimike <13286568797@163.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review identifies no active issues with the opt-in live API smoke-testing changes.

No open issues 🎉

What changed in this PR

Adds opt-in live API smoke testing to TypeChat’s TypeScript suite, continuing #430 toward resolving #328 while keeping mocked regression tests unconditional and hosted requests disabled by default.

Changes:

  • Adds a process-isolated smoke test for OpenAI Chat Completions, Responses, and Azure OpenAI, enabled only by TYPECHAT_LIVE_TESTS=1.
  • Limits live requests to 30 seconds with no retries and fails visibly on missing configuration, request errors, or blank completions.
  • Adds offline loopback regression coverage and documents configuration, provider charges, and PowerShell usage.
File Description
typescript/​tests/​model.test.mjs Restores native fetch after mocked tests.
typescript/​tests/​model-live.test.mjs Adds the gated live smoke test using the existing model factory.
typescript/​tests/​model-live-runner.test.mjs Verifies gating, provider routing, isolation, failures, and timeouts with loopback fixtures.
typescript/​README.md Documents live-test setup, safeguards, and expected behavior.

Review effort: Balanced

@robgruen
robgruen merged commit 0ef51b0 into main Nov 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update tests to call actual API if available, mock otherwise

4 participants